/*---------请使用fgets/fputc拷贝一个文件-----------*/
#include <stdio.h>

int main(int argc,const char * argv[])
{
    FILE* sfp;
    FILE* dfp;
    char ch = 0;

    if(3 != argc)
    {
        printf("input error,try agian\n");
        printf("usage:./a.out srcfile destfile\n");
        return -1;
    }
    if(NULL == (sfp = fopen(argv[1],"r")))
    {
        perror("fopen src file error");
        return -1;
    }
    if(NULL == (dfp = fopen(argv[2], "w")))
    {
        perror("fopen drc file error");
        return -1;
    }
    while(EOF != (ch = fgetc(sfp)))
    {
        fputc(ch, dfp);
    }

    fclose(sfp);
    fclose(dfp);

    return 0;
}